﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace _6i
{
    public partial class ContactEdit : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (string.Compare(Request.Cookies["mode"].Value, "add") == 0)
            {
                // add mode
                DetailsView1.DefaultMode = DetailsViewMode.Insert;
                //lblTitle.Text = "Add New Contact";
            }
            else
            {
                //edit mode
                //lblTitle.Text = "Edit Contact";
                //we check if postback as we want directly editable right away
                if (!IsPostBack)
                {
                    DetailsView1.DefaultMode = DetailsViewMode.Edit;
                }
                else
                {
                    DetailsView1.DefaultMode = DetailsViewMode.ReadOnly;
                }
            }
        }
    }
}